#include <QDebug>
#include <QDate>
#include "DateValidator.h"

DateValidator::DateValidator(QObject *parent) :
	QValidator(parent)
{
}

QValidator::State DateValidator::validate(QString &strVal, int &iPos) const
{
	State state(QValidator::Intermediate);
	QDate date = QDate::fromString(strVal, "yyyy-MM-dd");

	if(date.isValid()) state = QValidator::Acceptable;

	qDebug() << strVal << iPos << state;

	return state;
}
